From a04f3ca3d09185d48e4f5262cb09e15c4332758a Mon Sep 17 00:00:00 2001 From: oliskoli Date: Tue, 3 Jun 2008 16:02:02 +0000 Subject: [PATCH] osm: Add support for hdop,vdop,pdop,sat and fix (patch from Rory). --- osm.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/osm.c b/osm.c index 5c9ad7764..4900f069d 100644 --- a/osm.c +++ b/osm.c @@ -579,7 +579,36 @@ osm_node_tag(const char *args, const char **attrv) else wpt->notes = xstrdup(str); } - + else if (strcmp(key, "gps:hdop") == 0) { + wpt->hdop = atof(str); + } + else if (strcmp(key, "gps:vdop") == 0) { + wpt->vdop = atof(str); + } + else if (strcmp(key, "gps:pdop") == 0) { + wpt->pdop = atof(str); + } + else if (strcmp(key, "gps:sat") == 0) { + wpt->sat = atoi(str); + } + else if (strcmp(key, "gps:fix") == 0) { + if (strcmp(str, "2d") == 0) { + wpt->fix = fix_2d; + } + else if (strcmp(str, "3d") == 0) { + wpt->fix = fix_3d; + } + else if (strcmp(str, "dgps") == 0) { + wpt->fix = fix_dgps; + } + else if (strcmp(str, "pps") == 0) { + wpt->fix = fix_pps; + } + else if (strcmp(str, "none") == 0) { + wpt->fix = fix_none; + } + } + xfree(str); } @@ -785,6 +814,40 @@ osm_waypt_disp(const waypoint *wpt) } gbfprintf(fout, ">\n"); + if (wpt->hdop) { + gbfprintf(fout, " \n", wpt->hdop); + } + if (wpt->vdop) { + gbfprintf(fout, " \n", wpt->vdop); + } + if (wpt->pdop) { + gbfprintf(fout, " \n", wpt->pdop); + } + if (wpt->sat > 0) { + gbfprintf(fout, " \n", wpt->sat); + } + + switch (wpt->fix) { + case fix_2d: + gbfprintf(fout, " \n"); + break; + case fix_3d: + gbfprintf(fout, " \n"); + break; + case fix_dgps: + gbfprintf(fout, " \n"); + break; + case fix_pps: + gbfprintf(fout, " \n"); + break; + case fix_none: + gbfprintf(fout, " \n"); + break; + case fix_unknown: + default: + break; + } + gbfprintf(fout, "